package com.example.telesys.controller;

import com.example.telesys.pojo.ApiResponse;
import com.example.telesys.pojo.Broadband;
import com.example.telesys.pojo.StatusCode;
import com.example.telesys.pojo.StatusMessage;
import com.example.telesys.service.BroadbandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/broadband")
public class BroadbandController {

    @Autowired
    private BroadbandService broadbandService;

    @RequestMapping("/selectAllBroadband")
    public ApiResponse selectAllBroadband(){
        List<Broadband> broadbands = broadbandService.selectAllBroadband();
        return new ApiResponse(StatusCode.SUCCESS, StatusMessage.SUCCESS, broadbands);
    }

    @RequestMapping("/selectBroadbandById")
    public ApiResponse selectBroadbandById(@RequestParam("broadbandid") String broadbandid){
        Broadband broadband = broadbandService.selectBroadbandById(broadbandid);
        return new ApiResponse(StatusCode.SUCCESS, StatusMessage.SUCCESS, broadband);
    }


}
